﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Revenue.ascx.cs" Inherits="CS424_9pts.Manager.Modules.Revenue" %>

<div class="section-header">
    <div class="title">
        <img src="../Common/ico-sales.png" alt="Revenue Report" />    
    </div>
    <div class="options">
    </div>
</div>

<p><strong>Monthly Revenue&nbsp;
    <asp:DropDownList ID="DropDownListMonth" runat="server" AutoPostBack="True" 
        onselectedindexchanged="DropDownListMonth_SelectedIndexChanged">
        <asp:ListItem Value="1">January</asp:ListItem>
        <asp:ListItem Value="2">February</asp:ListItem>
        <asp:ListItem Value="3">March</asp:ListItem>
        <asp:ListItem Value="4">April</asp:ListItem>
        <asp:ListItem Value="5">May</asp:ListItem>
        <asp:ListItem Value="6">June</asp:ListItem>
        <asp:ListItem Value="7">July</asp:ListItem>
        <asp:ListItem Value="8">August</asp:ListItem>
        <asp:ListItem Value="9">September</asp:ListItem>
        <asp:ListItem Value="10">October</asp:ListItem>
        <asp:ListItem Value="11">November</asp:ListItem>
        <asp:ListItem Value="12">December</asp:ListItem>
    </asp:DropDownList>
    </strong></p>
    
<asp:SqlDataSource ID="SqlDataSourceRevenueMonthly" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>" 
    SelectCommand="SELECT CarID, DatePurchased, ItemSubtotal, TotalPrice, CustomerID FROM Contract WHERE  month(DatePurchased) = @month">
    <SelectParameters>
        <asp:FormParameter DefaultValue="0" FormField="Revenue" Name="month" />
    </SelectParameters>
</asp:SqlDataSource>

<asp:GridView ID="gvRevenue" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataSourceID="SqlDataSourceRevenueMonthly" ForeColor="#333333" GridLines="None"
     ShowFooter="True" >
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="CarID" HeaderText="CarID" SortExpression="CarID" />
        <asp:BoundField DataField="DatePurchased" HeaderText="DatePurchased" 
            SortExpression="DatePurchased" />
        <asp:BoundField DataField="ItemSubtotal" HeaderText="ItemSubtotal" 
            SortExpression="ItemSubtotal" />
        <asp:BoundField DataField="TotalPrice" HeaderText="TotalPrice" 
            SortExpression="TotalPrice" />
        <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
            SortExpression="CustomerID" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>

<asp:SqlDataSource ID="SqlDataSourceRevenueQuarterly" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>" 
    SelectCommand="SELECT CarID, DatePurchased, ItemSubtotal, TotalPrice, CustomerID FROM Contract WHERE  month(DatePurchased) > (@quarter-1)*3 AND month(DatePurchased) <= (@quarter)*3">
    <SelectParameters>
        <asp:FormParameter DefaultValue="0" FormField="Revenue" Name="quarter" />
    </SelectParameters>
</asp:SqlDataSource>

<p><strong>Quarterly Revenue
<asp:DropDownList ID="DropDownListQuarter" 
        runat="server" AutoPostBack="True" 
        onselectedindexchanged="DropDownListQuarter_SelectedIndexChanged">
        <asp:ListItem Value="1">First Quarter</asp:ListItem>
        <asp:ListItem Value="2">Second Quarter</asp:ListItem>
        <asp:ListItem Value="3">Third Quarter</asp:ListItem>
        <asp:ListItem Value="4">Fouth Quarter</asp:ListItem>
    </asp:DropDownList>
    </strong></p>
<asp:GridView ID="gvRevenueQuarterly" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataSourceID="SqlDataSourceRevenueQuarterly" ForeColor="#333333" GridLines="None"
     ShowFooter="True" >
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="CarID" HeaderText="CarID" SortExpression="CarID" />
        <asp:BoundField DataField="DatePurchased" HeaderText="DatePurchased" 
            SortExpression="DatePurchased" />
        <asp:BoundField DataField="ItemSubtotal" HeaderText="ItemSubtotal" 
            SortExpression="ItemSubtotal" />
        <asp:BoundField DataField="TotalPrice" HeaderText="TotalPrice" 
            SortExpression="TotalPrice" />
        <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
            SortExpression="CustomerID" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
